﻿using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace CS795.TravelAgency.CarRental
{
    [ServiceContract]
    public interface IService
    {
        [OperationContract]
        [FaultContract(typeof(ArgumentException))]
        [FaultContract(typeof(SecurityTokenException))]
        Quote RequestQuote(Request request);

        [OperationContract]
        [FaultContract(typeof(ArgumentException))]
        [FaultContract(typeof(SecurityTokenException))]
        int MakeReservation(int quoteId);

        [OperationContract]
        [FaultContract(typeof(ArgumentException))]
        [FaultContract(typeof(SecurityTokenException))]
        void CancelReservation(int reservationId);

        [OperationContract]
        [FaultContract(typeof(ArgumentException))]
        [FaultContract(typeof(SecurityTokenException))]
        void ConfirmReservation(Confirmation confirmation);
    }

    [DataContract]
    public class Quote
    {
        [DataMember]
        public int Id;

        [DataMember]
        public decimal DailyPrice;

        [DataMember]
        public decimal TotalPrice;
    }

    [DataContract]
    public enum CarType
    {
        [EnumMember]
        Coupe,
        [EnumMember]
        Sedan,
        [EnumMember]
        Minivan,
        [EnumMember]
        SUV,
        [EnumMember]
        Truck
    }

    [DataContract]
    public enum CardType
    {
        [EnumMember]
        Visa,
        [EnumMember]
        Mastercard,
        [EnumMember]
        Discover,
        [EnumMember]
        AmericanExpress
    }

    [DataContract]
    public class Request
    {
        [DataMember]
        public CarType Type;

        [DataMember]
        public DateTime StartDate;

        [DataMember]
        public DateTime EndDate;
    }

    [DataContract]
    public class Confirmation
    {
        [DataMember]
        public int ReservationId;

        [DataMember]
        public string Name;

        [DataMember]
        public string AddressLine1;

        [DataMember]
        public string AddressLine2;

        [DataMember]
        public string City;

        [DataMember]
        public string State;

        [DataMember]
        public string ZipCode;

        [DataMember]
        public CardType CardType;

        [DataMember]
        public string CardNumber;

        [DataMember]
        public int CardExpirationMonth;

        [DataMember]
        public int CardExpirationYear;
    }
}
